﻿@model TGIApp.Model.Venue


@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Venue</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        
        <!-- Put a hidden field to keep track of addressid and contactid otherwise when posting the form it will take Venue.Address.Id = 0 and Venue.Contact.Id = 0  when object is created for Edit (post) -->
        @{ if (ViewContext.RouteData.Values["Action"].ToString().ToLower() == "edit")
           { 
            <div>
                @Html.HiddenFor(model => model.Address.Id)
                @Html.HiddenFor(model => model.Contact.Id)
            </div>
           }
        }
       @Html.EditorFor(model=> model.Address)
       @Html.EditorFor(model=> model.Contact)

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

